Skip to content

fix(ddns-updater): align template validation standards#657

Merged
mberlofa merged 2 commits into
mainfrom
fix/ddns-updater-template-standards
Jul 6, 2026
Merged

fix(ddns-updater): align template validation standards#657
mberlofa merged 2 commits into
mainfrom
fix/ddns-updater-template-standards

Conversation

@mberlofa

@mberlofa mberlofa commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Summary

  • align ddns-updater NOTES with the numbered HelmForge template standard
  • add centralized chart validation for ingress host requirements and reserved selector label overrides
  • preserve hostless ingress rendering for catch-all ingress rules and cover it with unittest coverage

Validation

  • make template-standards-check CHART=ddns-updater
  • helm unittest charts/ddns-updater
  • helm lint --strict charts/ddns-updater
  • make standards-check CHART=ddns-updater
  • make validate-chart CHART=ddns-updater TIMEOUT=900: FULLY VALIDATED (14 layers)
  • make site-sync-check CHART=ddns-updater
  • make release-check REPO=charts
  • make attribution-check REPO=charts

Site PR: helmforgedev/site#336
Issue: #633

Summary by CodeRabbit

  • New Features
    • Updated Helm install notes into a structured, step-by-step guide with access instructions, expanded configuration details, security settings, and grouped resources/troubleshooting.
  • Bug Fixes
    • Improved ingress rendering to omit the host field when no host is provided, enabling clean hostless/catch-all rules.
  • Bug Fixes / Validation
    • Added Helm-time validation to fail fast when ingress hosts are missing and to block podLabels from overriding chart selector labels.
  • Tests
    • Added ingress and validation test coverage, including hostless behavior and expected validation failure messages.

@coderabbitai

coderabbitai Bot commented Jul 3, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 9406ac84-c4f6-464e-9a4b-7247b68f9bfa

📥 Commits

Reviewing files that changed from the base of the PR and between e84bf07 and 62454a9.

📒 Files selected for processing (2)
  • charts/ddns-updater/templates/_helpers.tpl
  • charts/ddns-updater/tests/validation_test.yaml
🚧 Files skipped from review as they are similar to previous changes (1)
  • charts/ddns-updater/templates/_helpers.tpl

📝 Walkthrough

Walkthrough

Adds Helm validation for ingress hosts and selector label overrides, adjusts ingress host rendering for hostless rules, rewrites NOTES.txt into expanded installation and troubleshooting guidance, and adds tests covering validation and ingress output.

Changes

Chart validation and documentation update

Layer / File(s) Summary
Validation helper and template
charts/ddns-updater/templates/_helpers.tpl, charts/ddns-updater/templates/validate.yaml, charts/ddns-updater/tests/validation_test.yaml
New ddns-updater.validate helper fails rendering when ingress is enabled without hosts, or when podLabels overrides selector labels; wired via new validate.yaml template and covered by three test cases.
Ingress host rendering fix and test
charts/ddns-updater/templates/ingress.yaml, charts/ddns-updater/tests/ingress_test.yaml
Ingress rule host: field now rendered conditionally via a with .host block instead of always quoting .host; new test verifies hostless catch-all rules omit spec.rules[0].host.
NOTES.txt summary and access
charts/ddns-updater/templates/NOTES.txt
Adds installation summary, access instructions, getting started commands, and expanded credentials/configuration output.
NOTES.txt troubleshooting and resources
charts/ddns-updater/templates/NOTES.txt
Updates troubleshooting commands and replaces the final documentation link with a resources section.

Estimated code review effort: 2 (Simple) | ~15 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title is concise and accurately reflects the main theme: updating ddns-updater templates to meet validation standards.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/ddns-updater-template-standards

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Standards Check (GR-079) — PASS

Every changed chart fully passes standards-check.

@github-actions

github-actions Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

🟢 Security Scan: ddns-updater

Framework Score
MITRE + NSA + SOC2 93.93939%

✅ Security posture acceptable.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (2)
charts/ddns-updater/templates/_helpers.tpl (1)

46-56: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Selector-label keys are duplicated instead of derived from ddns-updater.selectorLabels.

The reserved keys app.kubernetes.io/name / app.kubernetes.io/instance are hardcoded here, duplicating the same keys already defined in the ddns-updater.selectorLabels template (Lines 29-32). If the selector labels are ever extended, this validation could silently miss new reserved keys.

♻️ Suggested refactor: derive reserved keys from the labels template output
 {{- define "ddns-updater.validate" -}}
 {{- if and .Values.ingress.enabled (not .Values.ingress.hosts) -}}
 {{- fail "ingress.hosts must contain at least one rule when ingress.enabled=true" -}}
 {{- end -}}
+{{- $selectorLabels := fromYaml (include "ddns-updater.selectorLabels" .) -}}
 {{- range $key, $_ := .Values.podLabels -}}
-{{- if or (eq $key "app.kubernetes.io/name") (eq $key "app.kubernetes.io/instance") -}}
+{{- if hasKey $selectorLabels $key -}}
 {{- fail (printf "podLabels must not override selector label %q" $key) -}}
 {{- end -}}
 {{- end -}}
 {{- end -}}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@charts/ddns-updater/templates/_helpers.tpl` around lines 46 - 56, The
validation in ddns-updater.validate hardcodes reserved pod label keys instead of
deriving them from ddns-updater.selectorLabels. Update the podLabels check to
reuse the selector label set generated by ddns-updater.selectorLabels so any
future selector-label additions are automatically enforced. Keep the existing
fail behavior, but replace the duplicated key list with logic that compares
against the selector labels template output.
charts/ddns-updater/tests/validation_test.yaml (1)

19-25: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Missing test for the app.kubernetes.io/instance override branch.

Only the app.kubernetes.io/name override is tested; the sibling condition for app.kubernetes.io/instance (in the ddns-updater.validate helper) is untested.

✅ Suggested additional test case
   - it: should fail when podLabels override selector labels
     set:
       podLabels:
         app.kubernetes.io/name: custom
     asserts:
       - failedTemplate:
           errorMessage: 'podLabels must not override selector label "app.kubernetes.io/name"'
+
+  - it: should fail when podLabels override the instance selector label
+    set:
+      podLabels:
+        app.kubernetes.io/instance: custom
+    asserts:
+      - failedTemplate:
+          errorMessage: 'podLabels must not override selector label "app.kubernetes.io/instance"'
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@charts/ddns-updater/tests/validation_test.yaml` around lines 19 - 25, Add a
validation test that covers the sibling selector-label override branch in
ddns-updater.validate for app.kubernetes.io/instance, since only
app.kubernetes.io/name is currently asserted. Mirror the existing failedTemplate
pattern in validation_test.yaml by setting podLabels.app.kubernetes.io/instance
to a custom value and expecting the corresponding error message that podLabels
must not override selector label "app.kubernetes.io/instance".
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@charts/ddns-updater/templates/NOTES.txt`:
- Around line 35-41: The pod and log commands in NOTES.txt are using the app
name label only, which can match resources from other releases in the same
namespace. Update the selectors in the note commands to use the release-scoped
label with app.kubernetes.io/instance, matching the pattern already used later
in the file, and apply the same fix to the other referenced note blocks as well.
- Around line 17-22: The NOTES.txt Access guidance currently relies on the with
$host.host block, which suppresses the Web UI URL for hostless or catch-all
ingress setups. Update the ingress notes rendering to keep a generic access
instruction when .Values.ingress.enabled is true but no host is defined, while
still preserving the existing host-specific URL path for named hosts in the same
NOTES.txt template.

---

Nitpick comments:
In `@charts/ddns-updater/templates/_helpers.tpl`:
- Around line 46-56: The validation in ddns-updater.validate hardcodes reserved
pod label keys instead of deriving them from ddns-updater.selectorLabels. Update
the podLabels check to reuse the selector label set generated by
ddns-updater.selectorLabels so any future selector-label additions are
automatically enforced. Keep the existing fail behavior, but replace the
duplicated key list with logic that compares against the selector labels
template output.

In `@charts/ddns-updater/tests/validation_test.yaml`:
- Around line 19-25: Add a validation test that covers the sibling
selector-label override branch in ddns-updater.validate for
app.kubernetes.io/instance, since only app.kubernetes.io/name is currently
asserted. Mirror the existing failedTemplate pattern in validation_test.yaml by
setting podLabels.app.kubernetes.io/instance to a custom value and expecting the
corresponding error message that podLabels must not override selector label
"app.kubernetes.io/instance".
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 807c0b89-c82a-42c5-8a72-c5e27a265ea0

📥 Commits

Reviewing files that changed from the base of the PR and between 870b4c7 and 3651393.

📒 Files selected for processing (6)
  • charts/ddns-updater/templates/NOTES.txt
  • charts/ddns-updater/templates/_helpers.tpl
  • charts/ddns-updater/templates/ingress.yaml
  • charts/ddns-updater/templates/validate.yaml
  • charts/ddns-updater/tests/ingress_test.yaml
  • charts/ddns-updater/tests/validation_test.yaml

Comment thread charts/ddns-updater/templates/NOTES.txt
Comment thread charts/ddns-updater/templates/NOTES.txt Outdated
@mberlofa mberlofa force-pushed the fix/ddns-updater-template-standards branch from 3651393 to efdf989 Compare July 3, 2026 13:07
@mberlofa mberlofa force-pushed the fix/ddns-updater-template-standards branch from efdf989 to e84bf07 Compare July 4, 2026 16:14
@mberlofa

mberlofa commented Jul 5, 2026

Copy link
Copy Markdown
Contributor Author

Reviewed all CodeRabbit feedback in review threads and review-summary comments.

Changes:

  • Derived reserved podLabels keys from ddns-updater.selectorLabels instead of duplicating the selector label key names in validation logic.
  • Added validation coverage for overriding app.kubernetes.io/instance, alongside the existing app.kubernetes.io/name case.

Validation:

  • make validate-chart CHART=ddns-updater passed
  • Result: ddns-updater: FULLY VALIDATED (14 layers), including all k3d GR-027 scenarios
  • make release-check REPO=charts passed with only the expected post-merge release confirmation warning
  • make attribution-check REPO=charts passed
  • git diff --check passed

Note: these two CodeRabbit items were posted in the review summary/body, not as active review threads, so there are no thread IDs to reply to or resolve for them. Existing CodeRabbit inline threads are already resolved.

@mberlofa mberlofa merged commit d978ea0 into main Jul 6, 2026
17 checks passed
@mberlofa mberlofa deleted the fix/ddns-updater-template-standards branch July 6, 2026 08:29
mberlofa added a commit to helmforgedev/site that referenced this pull request Jul 6, 2026
## Summary
- add ddns-updater to the playground chart config mapping after the
chart template behavior update

## Validation
- npm run lint
- npm run format:check
- npm run build
- make site-sync-check CHART=ddns-updater
- make release-check REPO=site
- make attribution-check REPO=site

Chart PR: helmforgedev/charts#657
Issue: helmforgedev/charts#633

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **New Features**
* Added support for the `ddns-updater` chart in the playground, allowing
it to appear in the available chart list when applicable.
* **Bug Fixes**
* Improved chart inclusion behavior so playground results now reflect
the configured site sync entries more accurately.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:templates area:tests chart:ddns-updater Issues related to the ddns-updater chart size:M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant